package com.whg.demo.controller;

import com.whg.demo.exception.MyException;
import com.whg.demo.model.JsonData;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author whg
 * @create 2022/12/1 14:43
 * @description：
 */
@RestController
@RequestMapping("/except")
public class ExceptionController {

    @GetMapping("/test")
    public JsonData test(){
        int i = 1/0;
        return JsonData.buildSuccess();
    }

    @GetMapping("/myExcept")
    public Object myExcept(){
        throw new MyException(500,"my ext异常");
    }
}
